home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 May / Chip Mayıs 2001.iso / prog / share / 14 / setup.exe / %MAINDIR% / Scripts / sample.vbs < prev    next >
Encoding:
Text File  |  2001-03-30  |  4.1 KB  |  120 lines

  1. '********************************************************************
  2. '* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3. '* CuteFTP Pro Script Template
  4. '* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  5. '*
  6. '*This default template script is in Visual Basic. You can write
  7. '*scripts in your language of choice and save it with the proper
  8. '*extenstion, or use your an editor specific to that language
  9. '*
  10. '*
  11. '*See the help file for more details on how this scripting feature
  12. '*works. Below is a quick reference of supported commands, followed
  13. '*by a sample script. You must have Windows Scripting Host installed
  14. '*for the COM enabled engine to work
  15. '*
  16. '*----TEConnection object command reference---
  17. '*
  18. '*Public members (Data type followed by the command)
  19. '*See the help file for a more detailed list
  20. '*
  21. '*BSTR Host
  22. '*BSTR Protocol
  23. '*Long Port
  24. '*BSTR Login
  25. '*BSTR Password
  26. '*BSTR UseProxy
  27. '*BSTR TransferType
  28. '*BSTR LocalFolder
  29. '*BSTR RemoteFolder
  30. '*BSTR LocalFilterExclude, LocalFilterInclude
  31. '*BSTR RemoteFilterExlude, RemoteFilterInclude
  32. '*Long Retries
  33. '*Long Delay
  34. '*BSTR Autorename
  35. '*BSTR Links
  36. '*
  37. '*Public functions - Return Type | Function Name ([argument1],[arguement2])
  38. '*void Connect ()
  39. '*void Download (BSTR RemoteName, BSTR LocalName)
  40. '*void Upload (BSTR LocalName, BSTR RemoteName)
  41. '*void CreateLocalFolder (BSTR strName)
  42. '*void CreateRemoteFolder (BSTR strName)
  43. '*void LocalRemove (BSTR strName)
  44. '*void RemoteRemove (BSTR strName)
  45. '*void RemoteRename (BSTR strFrom, BSTR strTo)
  46. '*void LocalRename (BSTR strFrom, BSTR strTo)
  47. '*short LocalExist (BSTR strName)
  48. '*short RemoteExist (BSTR strName)
  49.  
  50.  
  51. '*****************************************************************
  52. 'Sample Script in Visual Basic
  53. 'Sample script using the TEConnection object
  54. 'Look into c:\temp folder to observe local activity (for testing purposes)
  55. 'or Right Click on the Transfer Engine icon in the systray and select "show current transfers"
  56. 'Uses an anonymous login to ftp://kyle.globalscape.net
  57.  
  58.     'First specify a variable called Mysite
  59.     Dim MySite
  60.  
  61.     'Creating a connection object and assign it to the variable
  62.     Set MySite = CreateObject("CuteFTPPro.TEConnection")
  63.  
  64.     'Now set each property for the site connection or use the defaults
  65.     MySite.Protocol = "FTP"
  66.     MySite.Host = "kyle.globalscape.com"
  67.     MySite.Login = "anonymous"
  68.     MySite.Password = "user@user.com"
  69.     MySite.RemoteFolder = "/Pub/cuteftp"
  70.     MySite.UseProxy = "BOTH"
  71.  
  72.  
  73.     'Now see if the local folder exists
  74.     If (Not (MySite.LocalExists("c:\temp"))) Then
  75.  
  76.         'Create it if necessary
  77.         MySite.CreateLocalFolder "c:\temp"
  78.  
  79.     'end of the if/then/else clause
  80.     End If
  81.  
  82.     'Change directories to the destination folder
  83.     MySite.LocalFolder = "c:\temp"
  84.  
  85.     'Check if the remote folder exists using another method
  86.     b = MySite.RemoteExists("english")
  87.  
  88.     'assign the above in to a variable then qualify it
  89.     If (Not b) Then
  90.  
  91.         'tell the user that the folder was not found and quit since i have no
  92.         ' permission to create the remote folder anyway
  93.         MsgBox "Remote folder not found!. Please make sure that the english folder exists on the remote site"
  94.  
  95.         Quit(1)
  96.     End If
  97.  
  98.     'Downloading the english folder with all its files into the
  99.     'local destination folder, giving it a new long name
  100.     MySite.Download "english", "latest english cuteftp version"
  101.  
  102.     MsgBox "Folder english was successfully downloaded to c:\temp\latest english cuteftp version"
  103.  
  104.     'now we are going to rename the local folder to something shorter
  105.     'but first check to see if a folder with that name already exist.
  106.     If (MySite.LocalExists("Latest")) Then
  107.         MySite.LocalRemove "Latest"
  108.         MsgBox "Previous version of Latest deleted"
  109.     End If
  110.  
  111.     'Rename the local folder
  112.     MySite.LocalRename "latest english cuteftp version", "Latest"
  113.  
  114.     MsgBox "Folder renamed to Latest"
  115.  
  116.     'Done
  117.     'End of sample script.
  118.     'You can save you script and then run it by either selecting it from the Tools > Run
  119.     'Script menu of by double clicking on the script file in Windows
  120.